package Operatori;


public final class Minus extends Operator {
	public double calcul(double aux1,double aux2){
		return aux1-aux2;
	}
	
	public static double Calcul(double aux1,double aux2){
		return aux1-aux2;
	}
	
	public double calculDerivata(){
		if(fStang==null || fDrept==null)
			System.exit(1);
		return calcul(fStang.calculDerivata(),fDrept.calculDerivata());
	}
	
	public String derivare(){
		if(fStang==null || fDrept==null)
			System.exit(1);
		return concatTermeni(fStang.derivare(),fDrept.derivare());
	}
	
	public String concatTermeni(String a,String b){
		String aux;
		if(a.compareTo("0")==0 || b.compareTo("0")==0)
			aux=a;
		else
			if(a.compareTo("0")==0)
				aux=b;
			else 
				if(b.compareTo("0")==0)
					aux=a;
				else
					aux=a+"-"+b;
		return aux;
	}
	
	public static String concatTermens(String a,String b){
		String aux;
		if(a.compareTo("0")==0 || b.compareTo("0")==0)
			aux=a;
		else
			if(a.compareTo("0")==0)
				aux=b;
			else 
				if(b.compareTo("0")==0)
					aux=a;
				else
					aux=a+"-"+b;
		return aux;
	}

}
